-
-
Notifications
You must be signed in to change notification settings - Fork 118
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update hyper #191
Update hyper #191
Conversation
What's the status of this PR? It looks like travis is failing because |
There's been a lot of churn in the last few weeks, this will need a lot of reworking. Might get some time to take a look in the next couple of weeks |
Still working on this, slowly! It doesn't build, I haven't tested anything, and I've got loads left to do. Will try and push a WIP in the next few days. May also need some help on a couple of things, and would certainly appreciate some code reviews. Any volunteers? |
Sure, just push commits and ask questions/reviews. I'll pick them up as much as I can, and other people might join too. |
200f598
to
166b398
Compare
that's the painful stuff done. There was a surprising amount of yak-shaving went into this.
This is still very much a work in progress |
I'd appreciate some feedback on the ergonomics of return pinned vs unpinned streams. On the one hand, returning Unpin streams makes them far easier to work with for the consumer. It does mean an extra allocation in many return functions to create On the other hand, it seems perhaps more "Rusty" to avoid the extra allocation and let the consumer pin the stream if they need to Or maybe there's a far easier way to return Unpin streams without having to box everything that I'm missing |
The checks are now passing before we can start to talk about merging-
|
doing some refactoring now. the Options structs are a little unusual-
impl ContainerOptions {
/// return a new instance of a builder for options
pub fn builder(name: &str) -> ContainerOptionsBuilder {
ContainerOptionsBuilder::new(name)
}
/// serialize options as a string. returns None if no options are defined
pub fn serialize(&self) -> Result<String> {
serde_json::to_string(&self.to_json()).map_err(Error::from)
}
fn to_json(&self) -> Value {
let mut body_members = Map::new();
// The HostConfig element gets initialized to an empty object,
// for backward compatibility.
body_members.insert("HostConfig".to_string(), Value::Object(Map::new()));
let mut body = Value::Object(body_members);
self.parse_from(&self.params, &mut body);
body
}
pub fn parse_from<'a, K, V>(
&self,
params: &'a HashMap<K, V>,
body: &mut Value,
) where
&'a HashMap<K, V>: IntoIterator,
K: ToString + Eq + Hash,
V: Serialize,
{
for (k, v) in params.iter() {
let key_string = k.to_string();
insert(&mut key_string.split('.').peekable(), v, body)
}
}
} strange, no? strongly typing the options is probably a battle for a different day. hard to resist large-scale refactors since this pull request already touches on so much code. |
Yes, maybe @softprops know if there is a reason behind this decision. Is there? |
I'll take a look this weekend. Context for the off serialization schemes. This crate predates serde's existence and stablization of proc macros which enabled deriving serialization on stable rust. Over time this crate has incorporated pulls from contributors that add components which get it part way there but I believe there needs to be a total overall of de/see realization that is only based on derives. I don't have the bandwidth for this now but would welcome such a pull. I don't think that serialization needs to be coupled to a change to the way io is managed. |
@softprops thanks for weighing in there. Agreed on all points |
Just released 0.6.0. I think targeting 0.7 would be good for updating hyper and the async io deps |
Cool beans. Running into difficulties now concerning the split eco system between futures::AsyncWrite/Read and tokio:: AsyncWrite/Read. Tokio are making noises about reporting the futures traits, which would solve all my problems. I'll do a bit more investigation, but i might be blocked until that occurs |
@danieleades, I took your branch and updated hyper to the latest release version (see here). Can you pull this commit into your branch so that it is included in this PR? |
Hi, thanks for this. I've actually been chipping away at this in a different branch and making much more drastic changes
it's been on hold for a little while as i have been very busy drinking alcohol and eating food these last couple of weeks, but i will try to push something soon. |
dkregistry-rs and shiplift need newer version of tokio (see camallo/dkregistry-rs#138 and softprops/shiplift#191)
@danieleades, thanks for the update. Until then I will work with my fork. |
dkregistry-rs and shiplift need newer version of tokio (see camallo/dkregistry-rs#138 and softprops/shiplift#191)
@danieleades, did you run into following issue and do you address it in your branch? I'm trying to inspect multiple containers with
and the compiler tells me:
I think that @softprops, what do you think about this PR (potentially including 9f4c6c09). |
Actually, I did neither. I created an http client object, which gets passed down from the docker client to the containers client in an Arc. |
dkregistry-rs and shiplift need newer version of tokio (see camallo/dkregistry-rs#138 and softprops/shiplift#191)
for those interested, i've pushed a branch with some of the refactoring i've done. it's a work in progress, but shows some changes that i think should be merged into master
I would absolutely say that the largest blocker to refactoring this crate is the absence of tests. Any effort to add some test coverage to the endpoints should be prioritised. I'm unlikely to take this further to be honest, it's a lot of work to refactor every endpoint in one hit, no matter how badly it needs it. I would be more than happy to contribute to this effort. In the meantime, i sincerely hope others can find some inspiration in the bits and pieces i've hacked together so far, and i'll be more than happy to help with any code reviews. I may get time to do some additional work on this, but i'm getting dragged off on other projects. apologies this isn't a more positive update! |
@danieleades thanks for all of your hard work on this! I've been eagerly watching the progress :) In regards to |
Async std and Tokio are largely interopable now that Tokio is re-exporting |
@danieleades do you have any intent to push this forward? If not I might take a shot at it. |
negative. Though I sincerely hope there's a lot of code here you can reuse! In all honesty, I did most of the work. But it was such a big refactor and without any tests i had no way of knowing if it actually worked. |
Thanks for your work on this. I'll try and pick up where you left off |
@softprops, I used an intermediate version of this PR in PREvant with an updated version of hyper. This version works fine and we use PREvant every day at work which involves permanent usage of the Docker API through shiplift. |
@softprops Other people have echoed similar thoughts, but would it be possible to merge this PR essentially as is into a branch like And, if the Also, I'm a newcomer to this project/PR (my project that uses this is just a week old!), so I just wanted to say thank you to everyone who contributed to the project and this PR for making such an ergonomic docker API. |
I made a branch on top of @schrieveslaach's and brought it up to date with master and got all tests and checks to pass. I'm using it successfully in my project, but I'm not exercising all paths in that project. |
sry folks the only blocker here for me is syncing with master to deal with the merge conflicts. If anyone can open a pr or help sync this pr. I'll be happy to merge so work can move forward |
My branch should work as that. I'll open a PR |
* it builds! * remove unused dependencies * bump dependencies * reimplement 'exec' endpoint * update a few more examples * update remaining examples * fix doc tests, remove unused 'read' module * remove feature-gated async closures * split futures dependency to just 'futures-util' * update version and readme * make functions accepting Body generic over Into<Body> again * update changelog * reinstate 'unix-socket' feature * reinstate 'attach' endpoint * fix clippy lints * fix documentation typo * fix container copyfrom/into implementations * add convenience methods for TtyChunk struct * remove 'main' from code example to silence clippy lint * Update hyper to 0.13.1 * Add Send bounds to TtyWriter * Appease clippy * Fix examples * Update issue in changelog Co-authored-by: Daniel Eades <danieleades@hotmail.com> Co-authored-by: Marc Schreiber <marc.schreiber@aixigo.de>
many thanks @elihunter173 for pushing this forward! |
@elihunter173 thanks for effort! |
What did you implement:
port of shiplift to futures-0.3
mostly complete, aside from the examples and a couple of methods
What (if anything) would need to be called out in the CHANGELOG for the next release:
This is a change to support async/await syntax. It is a BREAKING CHANGE